package edu.hitsz.prop;

import edu.hitsz.aircraft.enemy.AbstractEnemy;
import edu.hitsz.application.Game.Game;
import edu.hitsz.observer.BombObserver;

import java.util.LinkedList;
import java.util.List;


public  class BombProp extends AbstractProp {
    public static int power=50;
    private List<BombObserver> observers=new LinkedList<>();


    public BombProp(int locationX, int locationY, int speedX, int speedY) {
        super(locationX, locationY, speedX, speedY);
    }

    /**
     * 观察者模式
     */
    public void registerObserver(BombObserver o){
        observers.add(o);
    }
    public void removeObserver(BombObserver o){
        observers.remove(o);
    }

    public void notifyObserver(){
        for(BombObserver observer:observers){
            observer.update();
        }
    }

    @Override
    public void propAction() {

        notifyObserver();
        while (!observers.isEmpty()){
            observers.clear();
        }

    }

}